gh-117398: gh-119655: datetime: Init static state once & don't free it#119662
Merged
encukou merged 3 commits intopython:mainfrom May 28, 2024
Merged
gh-117398: gh-119655: datetime: Init static state once & don't free it#119662encukou merged 3 commits intopython:mainfrom
encukou merged 3 commits intopython:mainfrom
Conversation
This was referenced May 28, 2024
vstinner
reviewed
May 28, 2024
| } | ||
| // (capsule == NULL) {is handled by PyModule_Add | ||
| if (PyModule_Add(module, "datetime_CAPI", capsule) < 0) { | ||
| PyMem_Free(capi); |
Member
There was a problem hiding this comment.
It's not correct to free capi here?
Member
Author
There was a problem hiding this comment.
capi is static, we should not free it.
ericsnowcurrently
approved these changes
May 28, 2024
Modules/_datetimemodule.c
Outdated
Comment on lines
7009
to
7020
| PyMem_Free(capi); | ||
| goto error; | ||
| } | ||
| // (capsule == NULL) {is handled by PyModule_Add |
Member
There was a problem hiding this comment.
typo:
// (capsule == NULL) is handled by PyModule_Add.
Member
|
I'll take care of backporting this to 3.13 (by adding it into gh-119641). |
encukou
commented
May 28, 2024
|
ericsnowcurrently
pushed a commit
to ericsnowcurrently/cpython
that referenced
this pull request
May 28, 2024
…don't free it (pythonGH-119662) - While datetime uses global state, only initialize it once. - While `capi` is static, don't free it (thanks @neonene in https://github.com/python/cpython/pull/119641/files#r1616710048)
Contributor
|
Thanks! |
estyxx
pushed a commit
to estyxx/cpython
that referenced
this pull request
Jul 17, 2024
…don't free it (pythonGH-119662) - While datetime uses global state, only initialize it once. - While `capi` is static, don't free it (thanks @neonene in https://github.com/python/cpython/pull/119641/files#r1616710048)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
capiis static, don't free it (thanks @neonene in https://github.com/python/cpython/pull/119641/files#r1616710048)